﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using HinduShop.Domain.Models;

namespace HinduShop.UI.ViewModels.StoreManager
{
    public class ProductViewModel
    {
        public ProductViewModel()
        {
        }

        public ProductViewModel(Product product)
        {
            // Automapper
            ProductId = product.Id;
            ProductName = product.Name;
            
            if (product.Category != null)
                CategoryName = product.Category.Name;

            ProductPrice = product.Price;
            HasImage = product.ImageData != null;
        }

        public int ProductId { get; set; }
        public decimal ProductPrice { get; set; }
        public string ProductName { get; set; }
        public string CategoryName { get; set; }
        public HttpPostedFileBase Image { get; set; }
        public bool HasImage { get; set; }
    }
}